
<input type="button" onclick="javascript:mostrarOcultarcalendario_<%=request.getParameter("id")%>(true);" class="botonCalendario"/>
				
<div id="calendario_popUp_markup_<%=request.getParameter("id")%>">
	<div class="hd">Calendario</div>
		<div class="bd">
		<div id="calendario_markup_<%=request.getParameter("id")%>">
		</div>
	</div>
</div>


<SCRIPT LANGUAGE="JavaScript">

	calendario_<%=request.getParameter("id")%> = new YAHOO.widget.Calendar('calendario_markup_<%=request.getParameter("id")%>',
																	{ mindate:"1/1/2000",
																	  maxdate:"12/31/2020",
																	  WEEKDAYS_SHORT:  ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sa"],
																	  MONTHS_LONG: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]});

	calendario_<%=request.getParameter("id")%>.selectEvent.subscribe(handlerCalendario__<%=request.getParameter("id")%>, calendario_<%=request.getParameter("id")%>, true);
	calendario_<%=request.getParameter("id")%>.render();

	var _calendarioPopUp_<%=request.getParameter("id")%> = new YAHOO.widget.Panel("calendario_popUp_markup_<%=request.getParameter("id")%>", { 
		width:"205px",
		height:"265px",
		modal: true, 
		visible:false, 
		constraintoviewport:true, 
		fixedcenter: true, 
		icon: YAHOO.widget.SimpleDialog.ICON_INFO
		} 
	); 
	_calendarioPopUp_<%=request.getParameter("id")%>.render();

	function mostrarOcultarcalendario_<%=request.getParameter("id")%>(flag){
		if (flag) {
			_calendarioPopUp_<%=request.getParameter("id")%>.show()
		} else {
			_calendarioPopUp_<%=request.getParameter("id")%>.hide()
			
		}
	}

	function Right(str, n){
	    if (n <= 0)
	       return "";
	    else if (n > String(str).length)
	       return str;
	    else {
	       var iLen = String(str).length;
	       return String(str).substring(iLen, iLen - n);
	    }
	}
	  
	function handlerCalendario__<%=request.getParameter("id")%>(type,args,obj) {
		var dates = args[0];
		var date = dates[0];
		var year = date[0], month = date[1], day = date[2];

		var txtDate1 = document.getElementById("<%=request.getParameter("id")%>");
		txtDate1.value = Right("00" + day, 2) + "/" + Right("00" + month, 2) + "/" + Right("0000" + year, 4);
		mostrarOcultarcalendario_<%=request.getParameter("id")%>(false)
	}
	
	
</SCRIPT>